import request from '@/config/axios'

// PI 巡查任务 VO
export interface ConfigureVO {
  id: number // 主键
  code: string // 单据编号
  projectDate: Date // 日期
  bz: string // 备注
}

// PI 巡查任务 API
export const ConfigureApi = {
  // 查询PI 巡查任务分页
  getConfigurePage: async (params: any) => {
    return await request.get({ url: `/pi/configure/page`, params })
  },

  // 查询PI 巡查任务详情
  getConfigure: async (id: number) => {
    return await request.get({ url: `/pi/configure/get?id=` + id })
  },

  // 新增PI 巡查任务
  createConfigure: async (data: ConfigureVO) => {
    return await request.post({ url: `/pi/configure/create`, data })
  },

  // 修改PI 巡查任务
  updateConfigure: async (data: ConfigureVO) => {
    return await request.put({ url: `/pi/configure/update`, data })
  },

  // 删除PI 巡查任务
  deleteConfigure: async (id: number) => {
    return await request.delete({ url: `/pi/configure/delete?id=` + id })
  },

  // 导出PI 巡查任务 Excel
  exportConfigure: async (params) => {
    return await request.download({ url: `/pi/configure/export-excel`, params })
  },
  // 批量审核
  batchAuditConfigure:async(data:ConfigureVO[])=>{
    return await request.put({ url: `/pi/configure/batch-audit`, data })
  },
  // 批量派单
  batchDispatchConfigure:async(data:ConfigureVO[])=>{
    return await request.put({ url: `/pi/configure/batch-dispatch`, data })
  },

// ==================== 子表（PI 巡查任务明细） ====================

  // 获得PI 巡查任务明细列表
  getConfigureDetailListByPiProjectId: async (piProjectId) => {
    return await request.get({ url: `/pi/configure/configure-detail/list-by-pi-project-id?piProjectId=` + piProjectId })
  },
}
